// pages/record/history/history.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		
	},

	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad: function(options) {
		console.log(options)
		this.setData({
			id: options.id
		})
		this.push()
	},
	onShow(){
		this.push()
	},
	push() {
		wx.request({
			url: getApp().globalData.http + 'action=showMyBY&carid=' + this.data.id,
			success: (e) => {
				console.log(e.data.data)
				let a = e.data.data
				let r=''
				let g=''
				let b=''
				if (a.ByList.Times != '') {
					a.ByList.forEach(function(item, index) {
						 r = Math.floor(Math.random() * 256);
						 g = Math.floor(Math.random() * 256);
						 b = Math.floor(Math.random() * 256);
						 a.ByList[index].state ='rgb('+r+','+g+','+b+')'
					})
					this.setData({
						data: a,
					})
				}

			}
		})
	},
	onShow() {
		this.push()
	},
})
